﻿using BW.Demo.ErrorCode;
using BW.Demo.WebApi.Applications.Commands;
using BW.Demo.WebApi.Applications.Commands.Deputy;
using BW.Demo.WebApi.Applications.Commands.Upd;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BW.Demo.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UpdController : ControllerBase
    {
        IMediator mediator;
        
        public UpdController(IMediator mediator)
        {
            this.mediator = mediator;
            
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdPic([FromBody] PicUpdateCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdAquaculture([FromBody] AquacultureUpdCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
